package com.alks.function.mapper.finance.ryfinance;

import com.alks.entity.data.entity.PcMtlPreOther;
import com.alks.entity.data.entity.PcMtlPreOther2;
import com.alks.entity.data.entity.YfApAmt;
import com.alks.function.data.dto.PcMtlPreCheckReq;
import com.alks.function.data.dto.finance.ryfinance.MtlPreOtherInDto;
import com.alks.function.data.request.finance.ryfinance.MtlPreOtherInRequest;
import com.alks.function.data.vo.finance.mtlcosts.YfApExportVo;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.math.BigDecimal;
import java.util.List;
import java.util.Map;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author ms
 * @since 2024-05-20
 */
public interface PcMtlPreOtherMapper extends BaseMapper<PcMtlPreOther> {
    /*【荣阳财务-收货对账】：入库明细查询*/
    List<MtlPreOtherInDto> mtlPreOtherInQuery(@Param("request") MtlPreOtherInRequest request, @Param("companyId") String companyId);

    /*入库明细数据求和*/
    Map<String, Integer> mtlPreOtherSumQuery(@Param("request") MtlPreOtherInRequest request, @Param("companyId") String companyId);

    List<PcMtlPreOther2> pcMltPreCDList(PcMtlPreCheckReq req);

    void optionMtlPreCheck(List<PcMtlPreOther2> list, String choose);

    void setPriceInMtlPre(@Param("list") List<PcMtlPreOther2> list);

    void setSendAmt(List<PcMtlPreOther2> list);

    void updateMtlPre(List<PcMtlPreOther2> list);

    BigDecimal getSendQtyTotal(PcMtlPreCheckReq req);

    BigDecimal getPriceTotal(PcMtlPreCheckReq req);

    @Select("select distinct pur_type from PC_MTL_PRE_OTHER")
    List<String> getPurType();

    /**
     * 结算所需数据查询
     */
    List<YfApAmt> apAmpAddQuery(@Param("financeYymm") String financeYymm, @Param("vendorName") String vendorName, @Param("companyId") String companyId);

    /**
     * 结算所需数据更新
     */
    void apAmtAddUp(@Param("companyId") String companyId, @Param("financeYymm") String financeYymm, @Param("vendorName") String vendorName, @Param("slipNo") String slipNo);

    /**
     * 补充结算打印的送货单号和原单价
     * @param mtlVoList 待补充数据
     * @param companyId 公司ID
     * @return 补充后数据
     */
    List<YfApExportVo> suppDetailQuery(@Param("mtlVoList") List<YfApExportVo> mtlVoList, @Param("companyId") String companyId);
}
